<?php
require_once('../../config.php');
Doctrine::loadModels('../../models');

if( $_REQUEST["agent_id"])
{
	$image = new AgentImages();
	
	$image->agent_id = strip_tags($_REQUEST["agent_id"]);
	$image->image_type_id = strip_tags($_REQUEST["image_type_id"]);
	$image->image_name = strip_tags($_REQUEST["image_name"]);
	$image->location_name = strip_tags($_REQUEST["location_name"]);
	$image->created = date("Y-m-d H:m:s");
	$image->modified = date("Y-m-d H:m:s");
	//$image->created_by = $created_by;
	//$image->modified_by = $modified_by;
	$image->deleted = 0;

	$image->save();
	
	$imageID = $image->image_id;	
	
	$dom = new DomDocument('1.0');
	$dom->formatOutput = true;
	
	$root = $dom->createElement( "results" );
	$dom->appendChild( $root );
			$dn = $dom->createElement( "record" );
			$dn->setAttribute( 'imageID', $imageID );
			$root->appendChild( $dn );	
	
	header( "Content-type: text/xml");
	echo $dom->saveXML();
	
}

?>